﻿CREATE view [dbo].[VW_SumOfWXData] 

as 

select a.attnCnt,b.bindCnt ,c.apptCnt,c.apptSum ,d.payCnt,d.paySum from 

(select COUNT(*) as attnCnt from WxUser where UnsubscribeDt is null ) a ,

(select COUNT(*) as bindCnt from HospCard where RecStatus = 1 ) b,

(select COUNT(*) as apptCnt,SUM(SumFee) as apptSum from ApptOrder where PayState =1 and WxUserId <> 13) c,

(select COUNT(*) as payCnt,SUM(PrescMoney) as paySum from BillOrder where PayState = 1 and WxUserId <> 13) d

